package com.hgw.Demo07_ObserverPattern.examples;

/**
 * Data time:2021/12/19 16:18
 * StudentID:2019112118
 * Author:hgw
 * Description: 客户端测试类
 */
public class Client {
    public static void main(String[] args) {
        // 定义观察目标对象
        AllControlCenter acc;
        acc = new ConcreteAllyControlCenter("CSGOFIle");

        // 定义4个观察者对象
        Observer player1,player2,player3,player4;

        player1 = new Players("拉登是我干掉的");
        player2 = new Players("hgw689");
        player3 = new Players("橘子熟了");
        player4 = new Players("月亮瘪了");

        // 加入战队
        acc.join(player1);
        acc.join(player2);
        acc.join(player3);
        acc.join(player4);

        // 某成员遭受攻击
        player4.beAttacked(acc);
    }
}
